#    One Room And A Goblin Invasion
#    Copyright (C) 2014  Jannik Haberbosch
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.


# Python modules
import os
import os.path

# 3rd party modules
import pygame
pygame.init()

# Project modules
from code import game_constants


def load_image( filename, set_colorkey = True ):
	"""This functions loads an image from the "gfx" path and, by default,
	converts it to a per-pixel-format.
	Also, by default, it sets a colorkey (white) on the resulting surface.

	Returned is a pygame.surface Object.

	Parameters
		filename
		string
		The filename of the image.

		set_colorkey = True
		boolean
		Decides whether a white colorkey should be set on the image.

	Returns
		pygame.surface

	"""
	image = pygame.image.load(
		os.path.join(
			"gfx",
			filename
		)
	)
	image = image.convert()
	if set_colorkey:
		image.set_colorkey(
			game_constants.WHITE
		)
	
	return image


def load_sound( filename ):
	"""To be implemented when needed ...

	"""
	pass
